#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:

	vector<string> split(string str, string pattern)
	{
		string::size_type pos;
		vector<string> result;
		str += pattern;
		int size = str.size();
		for (int i = 0; i < size; i++)

		{
			pos = str.find(pattern, i);
			if (pos < size)
			{
				string s = str.substr(i, pos - i);
				result.push_back(s);
				i = pos + pattern.size() - 1;
			}
		}
		return result;
	}


	bool isPalindrome(string s) {
		transform(s.begin(), s.end(), s.begin(), ::tolower);
		for (int i = 0; i < s.size(); i++) {
			if (!isalnum(s[i]) && !isalpha(s[i])) {
				s.erase(s.begin() + i);
				i--;
			}
		}
		int left = 0, right = s.size() - 1;
		while (left < right) {
			if (s[left] != s[right])
				return false;
			left++, right--;
		}
		return true;
	}
};

int main() {
	string str = "race a car";
	Solution s;
	if (s.isPalindrome(str)) {
		cout << "111" << endl;
	}
	else cout << "222" << endl;
}